package com.tpc.yaoxpt.job;

import com.tpc.yaoxpt.schedule.DisOrderScheduleService;
import com.tpc.yaoxpt.schedule.GoodsScheduleService;
import javafx.concurrent.ScheduledService;
import javafx.util.Duration;

import java.util.concurrent.Executors;

public class DisOrderJob {
    ScheduledService<Void> disOrderSchedule = null;
    public void execScheduledService(){
        DisOrderScheduleService disOrderScheduleService = new DisOrderScheduleService();
        disOrderScheduleService.setExecutor(Executors.newFixedThreadPool(1));
        disOrderScheduleService.setDelay(Duration.millis(1000));
        disOrderScheduleService.setPeriod(Duration.millis(60000));
        disOrderScheduleService.start();
        disOrderSchedule = disOrderScheduleService;
    }

    public void stopScheduledService(){
        disOrderSchedule.cancel();
    }
}
